#include<bits/stdc++.h>
using namespace std;
using ll = long long;

ll n;

struct node{
    ll n, tot, alive, canattack;
};

constexpr ll phi = 1e5+9;
vector<ll> a;
ll buc[phi];

map<ll, ll> mp;
vector<node> p;

bool cmp(node a, node b){
    return a.n < b.n;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin>>n;
    for(int i=0;i<n;i++){
        ll temp;
        cin>>temp;
        mp[temp] ++;
    }

    for(auto item: mp){
        p.push_back({item.first, item.second, item.second, item.second}); // attack, nums, alive, canattack
    }

    sort(p.begin(), p.end(), cmp);

    ll ans = 0, canbeattack = p[0].tot;
    // ans: have dead, nowleft: have not dead
    for(ll i = 1; i<p.size(); i++){
        if(p[i].tot >= canbeattack){
            ans += canbeattack;
            canbeattack = 0;
        } else {
            // p[i].tot < canbeattack
            ans += p[i].tot;
            canbeattack -= p[i].tot;
        }
        
        canbeattack += p[i].tot;
        // if(p[i].tot >= p[i-1].tot){
        //     ans += p[i-1].tot;

        //     p[i].canattack -= p[i-1].tot;
        //     p[i-1].alive = 0;
            
        //     // canbeattack += p[i].tot - p[i].canattack; // p[i]'s not attackable

        // } else if (p[i].tot < p[i-1].tot){
        //     ans += p[i-1].tot - p[i].tot;

        //     p[i].canattack = 0;
        //     p[i-1].alive = p[i-1].tot - p[i].tot;
        //     canbeattack += p[i-1].alive; // p[i-1] has left
        // }

        // if(p[i].canattack > 0 && canbeattack > 0){
        //     if(p[i].canattack >= canbeattack)
        //         ans += canbeattack, canbeattack = 0;
        //     else
        //         ans += p[i].canattack, canbeattack -= p[i].canattack;
        // }
    }

    cout<<n-ans<<"\n";
    return 0;
}